package com.teradyne.phoenix.client.factory;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.event.shared.SimpleEventBus;
import com.google.gwt.place.shared.PlaceController;
import com.teradyne.phoenix.client.locale.AppLocale;
import com.teradyne.phoenix.client.views.AppMenuViewImpl;
import com.teradyne.phoenix.client.views.RolesView;
import com.teradyne.phoenix.client.views.RolesViewImpl;
import com.teradyne.phoenix.client.views.UserView;
import com.teradyne.phoenix.client.views.UserViewImpl;
import com.teradyne.phoenix.shared.PhoenixService;
import com.teradyne.phoenix.shared.PhoenixServiceAsync;

public class AppFactoryImpl implements AppFactory {
	private static final EventBus eventBus = new SimpleEventBus();
	private static final PlaceController placeController = new PlaceController(eventBus);
	private static final UserView userView = new UserViewImpl();
	private static final RolesView rolesView = new RolesViewImpl();
	private static final AppMenuViewImpl appMenuViewImpl = new AppMenuViewImpl();

	private final PhoenixServiceAsync phoenixRpcService = GWT
			.create(PhoenixService.class);

	private AppLocale locale = (AppLocale) GWT.create(AppLocale.class);

	@Override
	public EventBus getEventBus() {
		return eventBus;
	}

	@Override
	public PlaceController getPlaceController() {
		return placeController;
	}

	@Override
	public UserView getUserView() {
		return userView;
	}

	@Override
	public RolesView getRolesView() {
		return rolesView;
	}

	@Override
	public PhoenixServiceAsync getPhoenixService() {
		return phoenixRpcService;
	}

	@Override
	public AppLocale getAppLocale() {
		return locale;
	}

	@Override
	public AppMenuViewImpl getAppMenuViewImpl() {
		return appMenuViewImpl;
	}

}
